package com.zyn.inventory.management.dao;

import org.springframework.stereotype.Repository;

import com.zyn.inventory.management.entities.QRole;
import com.zyn.inventory.management.entities.Role;

import java.util.List;

@Repository
public class RoleDaoImpl extends BaseDaoImpl<Role> implements RoleDao {
    QRole role = QRole.role;

    public List<Role> getAll() {
        return query().from(role).listDistinct(role);
    }

    public Role getByAuthority(String authority) {
        return query().from(role).where(role.authority.eq(authority)).uniqueResult(role);
    }
    
}
